package com.etc.colldemo;

import java.util.HashSet;

/**
 * @author: knowno
 * @create: 2024-09-10 16:41
 * @Version 1.0
 *
 **/
public class TestHashSet2 {
    public static void main(String[] args) {

        A a1 = new A();
        System.out.println(a1.hashCode());


        A a2 = new A();
        System.out.println(a2.hashCode());

        HashSet set = new HashSet();
        set.add(a1);
        set.add(a2);

        System.out.println(set.size());
    }
}

class A extends  Object{

    @Override
    public int hashCode() {
        return 100;
    }

    @Override
    public boolean equals(Object obj) {
        return true;
    }
}
